/*
 * Copyright 2022-2023 the original author(https://github.com/wj596)
 * 
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */
package org.jsets.fastboot.flowable.service;

import java.util.List;
import java.util.Map;

import org.jsets.fastboot.flowable.model.entity.FlowTask;
import org.jsets.fastboot.flowable.model.dto.CompleteTaskParam;
import org.jsets.fastboot.flowable.model.dto.CompleteTaskResult;
import org.jsets.fastboot.flowable.model.dto.FlowTaskQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * 流程任务
 * @author wangjie (https://github.com/wj596)
 * @date 2021.06.25 11:23
 */
public interface IFlowTaskService {
	
	
	void autoComplete(String taskId, String reason, Map<String,Object> params);

	/**
	 * 完成任务(推到流程向前)
	 * @param param 参数
	 * @return CompleteTaskResult
	 */
	CompleteTaskResult complete(CompleteTaskParam param);

	/**
	 * 交办
	 * 
	 * @param taskId     任务ID
	 * @param targetUser 办理人
	 */
	boolean turnTask(String taskId, String targetUser);

	/**
	 * 委托任务（该节点的审批人变更为被委托人，在被委托人审批之后，无论同意还是拒绝，都会返回给委托人再次处理）
	 * 
	 * @param taskId     任务ID
	 * @param targetUser 被委托人
	 */
	boolean delegateTask(String taskId, String targetUser);
	
	/**
	 * 列表查询
	 * @param criteria 查询条件
	 * @return List<FlowTask>
	 */
	List<FlowTask> selectList(FlowTaskQuery criteria);
	
	/**
	 * 分页查询
	 * @param criteria 查询条件
	 * @return Page<FlowTask>
	 */
	Page<FlowTask> selectPage(FlowTaskQuery criteria);
}